//Include("Mz.G");

/**
 * @fileoverview 给元素element绑定事件(evt)的处理函数handler
 * @author meizz
 * @version 20090426
 *
 * @name Mz.on
 * @namespace Mz.on

 * @param {DOM/String} obj DOM元素或者其ID
 * @param {String} type 方法的名称
 * @param {Function} handler 事件的处理函数
 * @return {DOM} 绑定事件的节点
 */
Mz.on = function(obj, type, handler){
    if (!(obj = Mz.G(obj)) || typeof handler != "function"){ return obj;}
    
    type = type.replace(/^on/i, '').toLowerCase();

    if (obj.attachEvent) {
        var key = "__mz_guid";
        if (!handler[key]) {handler[key] = new Date().getTime();}

        key = 'on' + type + "_" + handler[key];
        obj[key] = function() {handler.call(obj, window.event);}
        obj.attachEvent('on' + type, obj[key]);
    } else if (obj.addEventListener) {
        obj.addEventListener(type, handler, false);
    }

    return obj;
};